/**
 * 
 */
package com.chenzehe.alimama.domain;

/**
 * @description 淘宝图片规格
 * @author chenzehe
 * @email hljuczh@163.com
 * @create 2013-11-29 上午11:23:12
 */
public class TaoBaoImg {

	String url;
	final String X80 = "_sum.jpg";
	final String X300 = "_300x300.jpg";
	final String X310 = "_310x310.jpg";

	/**
	 * 原图URL，如果不是原图URL，则自动设置为原图URL
	 * 
	 * @param url
	 */
	public TaoBaoImg(String url) {
		if (url.contains(X80)) {
			url = url.replace(X80, "");
		} else if (url.contains(X300)) {
			url = url.replace(X300, "");
		} else if (url.contains(X310)) {
			url = url.replace(X310, "");
		}
		this.url = url;
	}

	/**
	 * 返回原图URL
	 * 
	 * @return
	 */
	public String getUrl() {
		return this.url;
	}

	/**
	 * 返回80X80
	 * 
	 * @return
	 */
	public String get80() {
		return this.url + this.X80;
	}

	/**
	 * 返回80X80
	 * 
	 * @return
	 */
	public String get300() {
		return this.url + this.X300;
	}

	/**
	 * 返回80X80
	 * 
	 * @return
	 */
	public String get310() {
		return this.url + this.X310;
	}
}
